/*
 * @Author: szx
 * @Date: 2022-05-21 13:27:12
 * @LastEditTime: 2022-05-21 13:27:12
 * @Description:
 * @FilePath: \leetcode\200-299\287\287.js
 */
/**
 * @param {number[]} nums
 * @return {number}
 */
var findDuplicate = function (nums) {
    const sum = nums.reduce((a, b) => a + b);
    const n = nums.length - 1;
    const target = ((1 + n) * n) >> 1;
    return sum - target;
};
